/*
  Copyright © 2010  Vinícius dos Santos Oliveira

      This file is part of Touché.

      Touché is free software: you can redistribute it and/or modify
      it under the terms of the GNU Lesser General Public License as published
      by the Free Software Foundation, either version 3 of the License, or
      (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU Lesser General Public License for more details.

      You should have received a copy of the GNU Lesser General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */

#ifndef STAGEACTORLINK_H
#define STAGEACTORLINK_H

#include <QObject>
#include <QMutex>

namespace Touche        
{
    class StageActor;

    class StageActorLink: public QObject
    {
        Q_OBJECT

        static QList<StageActorLink *> m_links;

        StageActor *m_actors[2];

    public:
        StageActorLink(StageActor *item1, StageActor *item2);
        ~StageActorLink();
        QVector<StageActor *> actors();
        StageActor *sink(StageActor *src)
        {
            if(src == m_actors[0]){
                return m_actors[1];
            }else if(src == m_actors[1]){
                return m_actors[0];
            }else{
                return NULL;
            }
        }

        static const QList<StageActorLink *> &links();
        static StageActorLink *exists(StageActor *src, StageActor *sink);
    };
}

#endif // STAGEACTORLINK_H
